package com.wanmait.demo.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wanmait.demo.mapper.RepairOrderMapper;
import com.wanmait.demo.pojo.RepairOrder;
import com.wanmait.demo.service.RepairOrderService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class RepairOrderServiceimpl implements RepairOrderService {

    //zjj
    @Cacheable(value = "repairOrderCache",key = "'repairOrder'+#id")
    @Override
    public List<RepairOrder> findAllById(Integer id) {
        List<RepairOrder> list= null;

//        return repairOrderMapper.findAllByUserId(id);
        return null;

    }
    // zjj获得某个订单
    @Override
    public RepairOrder findByOrderId(Integer repairOrderId) {
//        RepairOrder repairOrder=repairOrderMapper.zjjselectByPrimaryKey(repairOrderId);
////        return repairOrder;
            return null;
    }
    //zjj
    @CacheEvict(value = "repairOrderCache" ,allEntries = true)
    @Override
   public void clearCache(){

    }

    @Override
    public int findWorker(Integer repairOrderId) {
        return repairOrderMapper.selectWorkerId(repairOrderId);
    }


    @Resource
    private RepairOrderMapper repairOrderMapper;
    @Override
    public void insert(RepairOrder object) {
    }

    @Override
    public void delete(Integer id) {

    }

    @Override
    public void delete(String ids) {

    }

    @Override
    public void update(RepairOrder object) {

    }

    @Override
    public RepairOrder findById(Integer id) {
        return null;
    }

    @Override
    public List<RepairOrder> findAll() {
        return null;
    }



    @Override
    public PageInfo<RepairOrder> findPage(int pageNum, int pageSize) {
        return null;
    }

    @Override
    public PageInfo getOrderByUserId(Integer userid) {
        return null;
    }
    //编写人：闫应鹏
    @Override
    public List<RepairOrder> findall(Integer workerId) {
        return repairOrderMapper.selectList(workerId);
    }
        //编写人：闫应鹏
    @Override
    public PageInfo<RepairOrder> findWorker(Integer workerId,Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<RepairOrder> repairOrders= repairOrderMapper.selectWorkerList(workerId);
        PageInfo<RepairOrder> pageInfo=new PageInfo<>(repairOrders,9);
        return pageInfo;

    }
    //编写人：闫应鹏
    @Override
    public void chargeback(Integer orderId) {
        repairOrderMapper.delectWorkerId(orderId);
    }

    @Override//尹山坤
    public void insertinfo(int userid, String name, String telnum, String des) {
        repairOrderMapper.insertinfo(userid,name,telnum,des);
    }

    @Override
    public void insertpic(String num) {
       ;//尹山坤 没用
    }

    @Override
    public void insertrepairorder(String pic, String username, String phonenum, String describe, Integer address, Integer timetable,Integer userid) {
//        repairOrderMapper.insertrepairorder(pic,username,phonenum,describe,address,timetable,userid);//尹山坤
    }

    @Override
    public RepairOrder selectorderaddress(Integer repairorderaddressid) {
//        return repairOrderMapper.selectorderaddress(repairorderaddressid);
        return  null;
    }

    @Override
    public List<RepairOrder> selectnotreceivingorders(Integer userid) {
//        return repairOrderMapper.selectnotreceivingorders(userid);//尹山坤  查询未接单的订单
        return null;
    }

    @Override
    public void updateorderstate(Integer orderid) {
//        repairOrderMapper.updateorderstate(orderid);//修改状态  尹山坤
    }

    @Override
    public List<RepairOrder> selectingorders(Integer userid) {
//        return repairOrderMapper.selectingorders(userid);
        return null;
    }


}
